# -*- encoding : utf-8 -*-
class CreateBooks < ActiveRecord::Migration
  def change
    create_table :books do |t|
      t.string :title
      t.string :author
      t.string :publisher
      t.integer :price
      t.integer :quantity
      t.integer :book_category_id
      
      t.timestamps
    end
    
    add_index :books, :book_category_id
    
    add_foreign_key(:books, :book_categories, column: 'book_category_id')
  end
end
